﻿using System;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for ReportsPageAccessDB
/// </summary>
/// 
namespace CE.UserAccess
{
    public class ReportsPageAccessDB
    {
        public ReportsPageAccessDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(ReportsPageAccess reportspageaccess)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocCXTHUserAccessReportsPagesInsertUpdateSingleItem";

            SortedList _sPara = new SortedList();

            #region Parameter

            _sPara.Add("@UserId", reportspageaccess.UserId);
            _sPara.Add("@PageId", reportspageaccess.PageId);
            _sPara.Add("@AccessLevel", reportspageaccess.AccessLevel);
            _sPara.Add("@Status", reportspageaccess.Status);

            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public DataTable GetReportsPageAccess(Int64 PageId, Int64 UserId)
        {
            MyDatabase _db = new MyDatabase();
            DataTable _dtResult = new DataTable();
            string _spName = "sprocCXTHUserAccessReportsPagesSelectItemListByUser";
            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@PageId", PageId);
            _sPara.Add("@UserId", UserId);
            #endregion

            _dtResult = _db.GetDataTableBySP(_spName, _sPara);

            return _dtResult;
        }

    }
}